package com.zhb.cms.domain.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PathVariable;

import com.zhb.cms.domain.dao.UrUserLoginInfoMapper;
import com.zhb.cms.domain.dao.UrUserOrgDeptInfoMapper;
import com.zhb.cms.domain.dao.UrUserOrgMenuInfoMapper;
import com.zhb.cms.domain.dao.UrUserOrgPortalInfoMapper;
import com.zhb.cms.domain.vo.UserOrgDeptVO;
import com.zhb.cms.domain.vo.UserOrgMenusVO;
import com.zhb.cms.domain.vo.UserOrgPortalVO;
import com.zhb.cms.domain.vo.UserTokenVO;
import com.zhb.cms.sdk.bean.Result;

@Service("userOrgDeptService")
public class UserOrgDeptService {

	@Autowired
	private UrUserOrgDeptInfoMapper urUserOrgDeptInfoMapper;
     /**
      * 
     * @Title: searchOrgDepts 
     * @Description: 查询用户的机构部门服务 
     * @author  张海滨  zhanghb22 
     * @date 2017年12月12日 下午6:50:19 
     * @return Result<List<UserOrgDeptVO>>    返回类型
      */
	public Result<List<UserOrgDeptVO>> searchOrgDepts(String userCd){
		List<UserOrgDeptVO> userOrgDeptVOList=urUserOrgDeptInfoMapper.searchUserOrgs(userCd);
		if(userOrgDeptVOList.size()>0)
		{
			for(UserOrgDeptVO userOrgDeptVO:userOrgDeptVOList){
				userOrgDeptVO.setChildren(urUserOrgDeptInfoMapper.searchUserDepts(userCd, userOrgDeptVO.getOrgCode()));
			}
		}
				
		return new Result<List<UserOrgDeptVO>>("0",null,userOrgDeptVOList);
	}
}
